package cn.bgs.service.impl;


import cn.bgs.mapper.ComplaintsMapper;
import cn.bgs.pojo.Complaints;
import cn.bgs.pojo.User;
import cn.bgs.service.IComplaintsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

import java.util.List;

/**
 * <p>
 * 投诉建议表 服务实现类
 * </p>
 *
 * @author cf
 * @since 2022-06-07
 */
@Service
public class ComplaintsServiceImpl extends ServiceImpl<ComplaintsMapper, Complaints> implements IComplaintsService {
    @Autowired
    private ComplaintsMapper mapper;
    @Override
    public List<Complaints> findAll(@Param("id") Integer id,@Param("zhangt") String zhangt,@Param("name") String name) {
        return mapper.findAll(id,zhangt,name);
    }

    @Autowired
    private ComplaintsMapper complaintsMapper;
    @Override
    public void appComlanints(Complaints complaints) {
      User aa= complaintsMapper.findTsUser(complaints.getTsname());

        LocalDateTime localDateTime = LocalDateTime.now();
      complaints.setTheComplainant(aa.getUserId());
      complaints.setProcessingState("未处理");
      complaints.setCreateTime(localDateTime);
      complaints.setUpdateTime(localDateTime);
      complaints.setDeleteFlag("n");
      complaintsMapper.appComlanints(complaints);


    }

    @Override
    public List<Complaints> appcomplaintinInfoFind() {
        return list();
    }
    @Override
    public List<Complaints> findById(Integer id) {
        return mapper.findById(id);
    }
}
